package org.example.springboot.service.impl;

import org.example.springboot.entity.AgricultureKnowledge;
import org.example.springboot.repository.AgricultureKnowledgeRepository;
import org.example.springboot.service.AgricultureKnowledgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class AgricultureKnowledgeServiceImpl implements AgricultureKnowledgeService {
    @Autowired
    private AgricultureKnowledgeRepository repository;

    @Override
    public List<AgricultureKnowledge> findAll() {
        return repository.findAll();
    }

    @Override
    public AgricultureKnowledge findById(Long id) {
        return repository.findById(id).orElse(null);
    }

    @Override
    public AgricultureKnowledge save(AgricultureKnowledge knowledge) {
        return repository.save(knowledge);
    }

    @Override
    public void deleteById(Long id) {
        repository.deleteById(id);
    }
} 